UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jYn0gJZq9A1ywAZMUw2o8xZSL7Kf1thJJkKKJ/lddj0='
WHERE
key_id = '8e12d9b7b770c74a6c8beabf3dc440912bd5e73c336cf466f60c48133c6f8137'
AND (
token = 'jYn0gJZq9A1ywAZMUw2o8xZSL7Kf1thJJkKKJ/lddj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)