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