UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n1Oilgy5CEh4CkYZVdRXBpT7NZuq8gpyBLDEl2l4XY0='
WHERE
key_id = 'dd7f7d576f66de4a83b8eccdd4486603eba88b35107d5f7b5ca094a9f2a0fdc9'
AND (
token = 'n1Oilgy5CEh4CkYZVdRXBpT7NZuq8gpyBLDEl2l4XY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)