UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lUyOIS5JRNIf/t0o/H+yWz4+ni4LQsXGnOvKFU+MI6U='
WHERE
key_id = '9e475461ad371ac42112ce0a73eec9ad414601da1f5c527e6b33804721d7f5ed'
AND (
token = 'lUyOIS5JRNIf/t0o/H+yWz4+ni4LQsXGnOvKFU+MI6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)