UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RbOdKZl9zjUgO/I5L0c7N7veVi03ry1phQWmjzTJrXo=' 
WHERE 
  key_id = '65969b80cb9e1e5a5826c356e3613797fff9d0c73a5987a2cb45484e94dac172' 
  AND (
    token = 'RbOdKZl9zjUgO/I5L0c7N7veVi03ry1phQWmjzTJrXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046