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