UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g/2fXeXw7sCyyxALW93P3edcn4vBslm1pdmnbO49xoU='
WHERE
key_id = '24971f88e6e689ba7a3c5a52fe6022cbf40586aa2dff967086e92e69367fcbd1'
AND (
token = 'g/2fXeXw7sCyyxALW93P3edcn4vBslm1pdmnbO49xoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)