UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AgZD11YT1u5PTrLoDrAKdFn+vijUkzpuyb/XoavnFoA='
WHERE
key_id = 'ac623e2367385723c7a4430ddc43cd8819e46e35b6e8745c8dcc4d899c18be22'
AND (
token = 'AgZD11YT1u5PTrLoDrAKdFn+vijUkzpuyb/XoavnFoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)