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