UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qaWqG1lf2N6WyRlGSqVAFGG7UHZ2+b6DCeDWYGUIfIw=' 
WHERE 
  key_id = '2cc7cf02838c38468a2a9e8bccd2165d98172172d46ab42d7c8ab6e83e806941' 
  AND (
    token = 'qaWqG1lf2N6WyRlGSqVAFGG7UHZ2+b6DCeDWYGUIfIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046