UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p7lkGElYLPtgZMssBBtxq20p5YSgDwJGoxd0ONzoGsw='
WHERE
key_id = '29f0e4c1b67bce8f5f4ea0317fd374a30e23a3a0edf0342981a36bdab87fb71b'
AND (
token = 'p7lkGElYLPtgZMssBBtxq20p5YSgDwJGoxd0ONzoGsw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)