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