UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AkmRnhWBxGLYDeAaW1LSn6Gf8VTrAYlzwb7N8029NzY=' 
WHERE 
  key_id = 'c6113dce5655571f250b7d7f45816a6520e99504e76b8dcb5bee2eaa7a772057' 
  AND (
    token = 'AkmRnhWBxGLYDeAaW1LSn6Gf8VTrAYlzwb7N8029NzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033