UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gd0zoxOJIpXTnJg1cyxBW9lDgAolo1MzYxm+9PS16Tk='
WHERE
key_id = '1b6f5ab486a2986e79305900ab998383d9f146c313f5a368d0b0418a3f24a0c5'
AND (
token = 'Gd0zoxOJIpXTnJg1cyxBW9lDgAolo1MzYxm+9PS16Tk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)