UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iudaU7kngX5k9lsdpcE2tMwZySnKWg6+g9zURvECc64=' 
WHERE 
  key_id = '229abca9d3c9888a48d034a47123f39a3d96a8f441ab79d1a599b806f999842a' 
  AND (
    token = 'iudaU7kngX5k9lsdpcE2tMwZySnKWg6+g9zURvECc64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030