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