UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A8fU1ORf/7LDrpvkgzr8pVZyQ57ijw/VegtFSH2XcnM='
WHERE
key_id = 'f015cc573d53cfd9406c21b7421ac2d167330718f176982f5b4e0da25d8a0145'
AND (
token = 'A8fU1ORf/7LDrpvkgzr8pVZyQ57ijw/VegtFSH2XcnM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)