UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eY8ry+t09qmCEZVnhTU0yg/LJQTQdva4pFiTcC90bqA='
WHERE
key_id = 'd5813992190165f40cc5d1c8045a9a7b84af355814af3ae14bb50df5d7345e8a'
AND (
token = 'eY8ry+t09qmCEZVnhTU0yg/LJQTQdva4pFiTcC90bqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)