UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sW4z/ZnFMJApfsorH/MCksvsTud6cv13zbAl8DsevfI=' 
WHERE 
  key_id = '92413871d777c46362b146768539a32a7fb749c8aa25d93727936f80f7a311f5' 
  AND (
    token = 'sW4z/ZnFMJApfsorH/MCksvsTud6cv13zbAl8DsevfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032