UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lyn2IPPo0pMFa2K/gaA5dTUXIueUuXN99BIgkTKDjpc=' 
WHERE 
  key_id = '59d26fa40bb233a0f8ec4444e6ead907f4edd32f28a27772dca45c75d68d1551' 
  AND (
    token = 'Lyn2IPPo0pMFa2K/gaA5dTUXIueUuXN99BIgkTKDjpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038