UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+Mi5ZNsNPhieKxsPxqoulQcjigPiIdTVusRNP94Rck='
WHERE
key_id = 'c846bd071eade85e6c3f484805ac839bfa782bfe411212bc0a3a39dae88448d9'
AND (
token = 'N+Mi5ZNsNPhieKxsPxqoulQcjigPiIdTVusRNP94Rck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)