UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5XM9D+myjCwjcT+9Evckzj10iU1OJk98l2bU8213Bik=' 
WHERE 
  key_id = '3978ea6fe69b3625cd2b2fa43d7e25c61648775e46b8c96af755512159f5c7d8' 
  AND (
    token = '5XM9D+myjCwjcT+9Evckzj10iU1OJk98l2bU8213Bik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025