UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CGcPPO8S9l7Ar+VJk5ZDHIDwQ5PXLNTucOkb5HMfNxs=' 
WHERE 
  key_id = 'cb384d2600000532e9a3114a3df60fafeb3731d0409dbc6429f13a7d1b3c8536' 
  AND (
    token = 'CGcPPO8S9l7Ar+VJk5ZDHIDwQ5PXLNTucOkb5HMfNxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023