UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0OhpcwIHWDQ5OJk1BdKZqFXoKcYSHSdMM4YWPy95izc='
WHERE
key_id = '33f02547a58b90c49ac82cbd5921a81b43dbe5ca0628cdc4334bc8563ce2f02c'
AND (
token = '0OhpcwIHWDQ5OJk1BdKZqFXoKcYSHSdMM4YWPy95izc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)