UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nI231B8accy0qwJDaaG3UlpKMfIlKGUjJhvDflabwKA=' 
WHERE 
  key_id = '7a9c53e28e18072f134b2865a4b950f860b79e4e9947a2cf20a00ad4e5059da8' 
  AND (
    token = 'nI231B8accy0qwJDaaG3UlpKMfIlKGUjJhvDflabwKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034