UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bOxf/WTMqhkx0sznTEzj79iZnl9F0tCuOuN56/WHC3M='
WHERE
key_id = '7de50c4b4c57acb65ef89153af664892bb9165a91b9f3090aa2e01bbe08a3282'
AND (
token = 'bOxf/WTMqhkx0sznTEzj79iZnl9F0tCuOuN56/WHC3M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)