UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P8AgDzUmnlSx8AAG1rrVgHbJoCBBYlAYQiahfiF/vFc='
WHERE
key_id = 'ccda8c0e6cce0f0a42145636a3bdb40698ea379cc67c0273bbdddf993699fbda'
AND (
token = 'P8AgDzUmnlSx8AAG1rrVgHbJoCBBYlAYQiahfiF/vFc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)