UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aU4LNrpr02JgNnepK/pQKOZOhXpXjLAouF4Lyw1VRbU=' 
WHERE 
  key_id = '415bf21afb6377a776e87550c065b02fe2e94374228ca5d878b63a78acac2679' 
  AND (
    token = 'aU4LNrpr02JgNnepK/pQKOZOhXpXjLAouF4Lyw1VRbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015