UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gTgaJTCCqL7uo9D8YFyMO0Z4/jQ7pf0rzFDAR4BckOo='
WHERE
key_id = 'c9d128e9472780a5546ae424a2571974854a124050d26204feba6ea1afad239d'
AND (
token = 'gTgaJTCCqL7uo9D8YFyMO0Z4/jQ7pf0rzFDAR4BckOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)