UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/pu6fhmVuZJ/x9T818sWN/aYjAtwydEFKsEG2etpBL4='
WHERE
key_id = 'd3529861dfbe9e4d978023e3174535096f13e98a0b7ae6933bc1a9e014e94374'
AND (
token = '/pu6fhmVuZJ/x9T818sWN/aYjAtwydEFKsEG2etpBL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)