UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xsdaMrEt8JT8w5YhvLmterqWvS+Ljhmf9qTl2fu6RcA='
WHERE
key_id = '9ae87406e8cd2e8e8692289d36b51ffe570cca0b30628ede0854ff7c31a6ed3e'
AND (
token = 'xsdaMrEt8JT8w5YhvLmterqWvS+Ljhmf9qTl2fu6RcA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)