UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L172kEoddJcyQw3QV54SxOPuvoHsgJo62a8D0je9rJ4='
WHERE
key_id = 'fb9f540d095ff7e4fc545f9a3566f188bb55d72aa2b3469afae1d138d059154d'
AND (
token = 'L172kEoddJcyQw3QV54SxOPuvoHsgJo62a8D0je9rJ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)