UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SmDZ+hj1WioRafp7eR4rGyTK88l3eC4R9PcdgGNYBNE='
WHERE
key_id = 'd1f69ef77a60a9b4fbf41d8f355460933f14a7de0c0877810bf6496b031cfca9'
AND (
token = 'SmDZ+hj1WioRafp7eR4rGyTK88l3eC4R9PcdgGNYBNE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)