UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RozQ45c+4txudxxGCRk68pfwTpJuxgOfWV4Q8Gwnbp4='
WHERE
key_id = '85c7dda51e7ef1185f5694807aad15047b568e06e943827949e1d0c531f344a6'
AND (
token = 'RozQ45c+4txudxxGCRk68pfwTpJuxgOfWV4Q8Gwnbp4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)