UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zm1zijNnsngnsGcmzIK1SutZqOl/0LaOftMRllIzccc=' 
WHERE 
  key_id = 'a700c9ecb3fed58860a08ae0534d01cafb5f3673ee630f544082f14355419777' 
  AND (
    token = 'Zm1zijNnsngnsGcmzIK1SutZqOl/0LaOftMRllIzccc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028