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