UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7qNPHeVZwOrTAE/H22LzG5TKiHcKIWQc38ja2ddiV+o='
WHERE
key_id = '81a0c6262c0a521eff8c6f27dd41d599119b29b443e94fa5ea4d95851b591927'
AND (
token = '7qNPHeVZwOrTAE/H22LzG5TKiHcKIWQc38ja2ddiV+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)