UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tjyODfFCZTUFT3OcOUrLjfXeBXXpIokg9MVuk58wT+U=' 
WHERE 
  key_id = '288624d50865e2954ff94c8829bed48a555b44b14fb01ee48c0b8f858b048b20' 
  AND (
    token = 'tjyODfFCZTUFT3OcOUrLjfXeBXXpIokg9MVuk58wT+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026