UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n0TND40eqwAskEX1Go57ubwLb6wrukE5ON2IB932MeM='
WHERE
key_id = '4f8255d8ebf51af6436c7ba70f1be03189a6dd3872cce4e3ef8dd0120c9890e3'
AND (
token = 'n0TND40eqwAskEX1Go57ubwLb6wrukE5ON2IB932MeM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)