UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X6lKSMMiVKuS+PDyggzuvY5JlZp9JWPoBJgBDOmjTFs=' 
WHERE 
  key_id = '37a334b1c7656ed21eef998c3f1be95229030570ebadcfeed8b48d3b399cf7b5' 
  AND (
    token = 'X6lKSMMiVKuS+PDyggzuvY5JlZp9JWPoBJgBDOmjTFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056