UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O2whLzGxohLm6ngPF/alC7jUS8XGLYrYCKRymuMX4xo=' 
WHERE 
  key_id = '577de4e2433c78f7d51341cae68ba73c5027865ff0e665b0626fcd34d42dc3ca' 
  AND (
    token = 'O2whLzGxohLm6ngPF/alC7jUS8XGLYrYCKRymuMX4xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033