UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o3krQIVUrqN7+eE+BgHqPYK8UNbLssnRggGfA4eZU/4=' 
WHERE 
  key_id = '77f2e9008552d8da49329478dde90005ed5f505cb48446e9f90db5c5a128a80f' 
  AND (
    token = 'o3krQIVUrqN7+eE+BgHqPYK8UNbLssnRggGfA4eZU/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029