UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nduRsDC+5HXTqkEkWlyyDIiIoh6qZYcu+Hdvc6U5C1g=' 
WHERE 
  key_id = '523b75931ec2d54da502cb529da24cde9bef153ea8062eaa2830fc5271fb63b0' 
  AND (
    token = 'nduRsDC+5HXTqkEkWlyyDIiIoh6qZYcu+Hdvc6U5C1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023