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