UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sg+cdkaYM1CF8+r4imS91Mi0eqm3ye+fdwlA4NIm/KY='
WHERE
key_id = 'dc81f9f10559fcf2e5f40ec7b9b0bf758f4017f9f0c9966eccd92896613b516d'
AND (
token = 'sg+cdkaYM1CF8+r4imS91Mi0eqm3ye+fdwlA4NIm/KY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)