UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PnKPMy9GFmy90+xoGvEZ7kLb7s7DVJXUZP6nAre3vBo='
WHERE
key_id = 'f91c12b49f6a3c8497fd517a1946be3911d83642b6ba94eb334c40f168ae6ae0'
AND (
token = 'PnKPMy9GFmy90+xoGvEZ7kLb7s7DVJXUZP6nAre3vBo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)