UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CDOy2cvf6xp9Yz8immYczCYogwYmKEY66cmEKP4CTkY=' 
WHERE 
  key_id = '8654aa0568fe82f4bcec00c621d73157c381b1811a10375d779e776f3a9d132a' 
  AND (
    token = 'CDOy2cvf6xp9Yz8immYczCYogwYmKEY66cmEKP4CTkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024