UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TWNE3eu3BFevHBlIyTW9cvtt7vE9RHS+PM2R/cI4kNA='
WHERE
key_id = 'e5f9e56631da74294fa24da5b52b7da3c00e249743ce87f88c519c2a527482d1'
AND (
token = 'TWNE3eu3BFevHBlIyTW9cvtt7vE9RHS+PM2R/cI4kNA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)