UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ygje9YYDz6ejUTKI5laEpJ1Qxz1XnK9245LV1QOzHU8=' 
WHERE 
  key_id = '50566fc072c354273bdb4620d3d1a93167e653cd2fbc7c1b2a5275f1dcb39c1e' 
  AND (
    token = 'Ygje9YYDz6ejUTKI5laEpJ1Qxz1XnK9245LV1QOzHU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028