UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kxH1E0gzvZx12X6D6h9ew7cdskSczEPQ5/5ILDVBGXQ='
WHERE
key_id = 'ad50ef66d6e09be3fd38bffef7a9960add15ec0f551ee0a1efa36ec135773296'
AND (
token = 'kxH1E0gzvZx12X6D6h9ew7cdskSczEPQ5/5ILDVBGXQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)